package gupao.concurrency.kms.disruptor;

public class ResultCollector {
    long startMilli;
    long endMilli;
    int consumerConcurrency = 0;
    String strategy;

    private static ResultCollector rc = new ResultCollector();

    public void setStrategy(String strategy) {
        this.strategy = strategy;
    }

    public static ResultCollector start(){
        rc.startMilli = System.currentTimeMillis();
        return rc;
    }

    public static void onCompleted(){
        rc.endMilli = System.currentTimeMillis();

        System.out.println("strategy: " + rc.strategy + ", Consumer Concurrency: " + rc.consumerConcurrency + ", timeCost: " + (rc.endMilli - rc.startMilli));
    }

    public static void addConsumer(){
        rc.consumerConcurrency++;
    }

    private ResultCollector() {
    }
}
